home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / PACKAGES / AWK320.ZIP / LOGSUM.AWK < prev    next >
Text File  |  1990-06-04  |  1KB  |  38 lines

  1. # LogSum.AWK by S.H. Moody, 09-06-89
  2. # The LOG.COM utility presented in Vol. 7, No. 21 (December 13, 1988) of
  3. # PC Magazine creates a USAGE.LOG file on your disk which contains
  4. # a log of all uses of .COM, .EXE, and .BAT while LOG.COM is installed.
  5. # This program aggregates the data by file name, counting up the number
  6. # of times each executable is run, and the total time it is active.
  7.  
  8. BEGIN {
  9.    print"Program Name        Times Used   Hours Used"
  10.    print"------------        ----------   ----------"
  11. }
  12.  
  13.    function timecvt(t, hours)  {
  14.       split(t, hms, ":");
  15.       hours = hms[1] + hms[2] / 60 + hms[3] / 3600;
  16.       return hours
  17.    }
  18.  
  19.  
  20. {
  21.    if($4 !~ /^[0-9]/) next
  22.  
  23.    thistime = timecvt($3)
  24.    program[$5]+= thistime;
  25.    tottime+= thistime;
  26.    nrun[$5]++;
  27.    totrun++;
  28. }
  29.  
  30. END {
  31.    for (n in program) {
  32.       numprog++;
  33.       printf("%-12s %14d %15.4f\n", n, nrun[n], program[n] );
  34.    }
  35.    printf("\nTotals (%3d progs)%9d %15.4f\n", numprog, totrun, tottime );
  36. }
  37.  
  38.